﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.peddlerUI.peddlerMarketUI {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;
    import flash.utils.*;
    import org.aswing.*;
    import Classes.*;
    import org.aswing.geom.*;
    import Display.*;
    import Display.ValentineUI.*;
    import Display.CopsBanditsUI.*;
    import flash.text.*;
    import Display.aswingui.*;

    public class PeddlerMarketDialogView extends CopsDialogView {

        public function PeddlerMarketDialogView(_arg1:Dictionary, _arg2:String="", _arg3:String="", _arg4:int=0, _arg5:Function=null, _arg6:String="", _arg7:int=0, _arg8:String="", _arg9:Function=null, _arg10:String=""){
            super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
        }
        override protected function getTitleString():String{
            var _local1:String = ZLoc.t("Dialogs", "PeddlerCenterTitle");
            return (_local1);
        }
        override protected function createIcon():AssetPane{
            return (new AssetPane((new EmbeddedArt.peddlerSuccess() as DisplayObject)));
        }
        override protected function makeTabsPanel():JPanel{
            var _local3:JPanel;
            var _local4:JPanel;
            var _local5:String;
            var _local6:JTextField;
            var _local7:TextFormat;
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER, 4);
            m_tabs = [ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER), ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER), ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER)];
            var _local2:int;
            while (_local2 < m_tabs.length) {
                _local3 = m_tabs[_local2];
                _local3.setPreferredSize(new IntDimension(TAB_WIDTH, TAB_HEIGHT));
                _local3.setMinimumSize(new IntDimension(TAB_WIDTH, TAB_HEIGHT));
                _local3.setMaximumSize(new IntDimension(TAB_WIDTH, TAB_HEIGHT));
                _local4 = ASwingHelper.makeSoftBoxJPanel(SoftBoxLayout.CENTER);
                _local5 = "";
                if (_local2 == (m_tabs.length - 1)){
                    _local5 = "";
                } else {
                    _local5 = ZLoc.t("Dialogs", ("PeddlerCenterTab" + _local2));
                    _local3.addEventListener(MouseEvent.MOUSE_UP, onTabClicked, false, 0, true);
                };
                _local6 = ASwingHelper.makeTextField(_local5, EmbeddedArt.TITLE_FONT, TAB_FONT_SIZE, EmbeddedArt.blueTextColor);
                _local7 = new TextFormat();
                _local7.size = TAB_CAP_FONT_SIZE;
                TextFieldUtil.formatSmallCaps(_local6.getTextField(), _local7);
                _local4.append(_local6);
                _local6.getTextField().height = (TAB_FONT_SIZE * 1.5);
                _local3.append(_local4);
                _local1.append(_local3);
                _local2++;
            };
            this.setSelectedTab(CopsDialog.DEFAULT_TAB, false);
            ASwingHelper.setEasyBorder(_local1, 0, 10, 0, 10);
            return (_local1);
        }
        override protected function createOfficersPanel():JPanel{
            m_officersPanel = new PeddlersPanel();
            m_officersPanel.addEventListener(MakerPanel.PREPARE, preparePane, false, 0, true);
            return (m_officersPanel);
        }
        public function refreshData():void{
            if (m_officersPanel){
                (m_officersPanel as PeddlersPanel).refreshData();
            };
        }
        override public function setSelectedTab(_arg1:int, _arg2:Boolean):void{
            var _local4:JPanel;
            var _local3:int;
            while (_local3 < (m_tabs.length - 1)) {
                _local4 = m_tabs[_local3];
                _local4.setBackgroundDecorator(new AssetBackground((new (m_tabStates[TAB_STATE_UNSELECTED])() as DisplayObject)));
                _local3++;
            };
            m_tabs[_arg1].setBackgroundDecorator(new AssetBackground((new (m_tabStates[TAB_STATE_SELECTED])() as DisplayObject)));
            m_contentPanel.removeAll();
            switch (_arg1){
                case 0:
                    m_contentPanel.appendAll(this.createOfficersPanel());
                    StatsManager.count("peddlercenter", "tab_select", "peddler_panel");
                    break;
                case 1:
                    m_contentPanel.appendAll(this.createEmptyPanel());
                    StatsManager.count("peddlercenter", "tab_select", "upgrade_panel");
                    break;
            };
            ASwingHelper.prepare(m_contentPanel);
            ASwingHelper.prepare(this.parent);
        }
        override protected function getSubHeadPanelData():String{
            return (String(Global.peddlerManager.successTimes));
        }
        override protected function getSubHeadPanelLocaliztionString():String{
            return (ZLoc.t("Dialogs", "peddlerSuccessTimes"));
        }
        private function createEmptyPanel():JPanel{
            var _local1:JPanel = ASwingHelper.makeSoftBoxJPanelVertical(SoftBoxLayout.CENTER);
            var _local2:DisplayObject = (new (CopsDialog.assetDict["inner_undertab"])() as DisplayObject);
            _local1.setBackgroundDecorator(new AssetBackground(_local2));
            _local1.setPreferredWidth(671);
            _local1.setPreferredHeight(390);
            var _local3:String = ZLoc.t("Dialogs", "ComeSoon");
            var _local4:JLabel = ASwingHelper.makeLabel(_local3, EmbeddedArt.DEFAULT_FONT_NAME_BOLD, 36, EmbeddedArt.blueTextColor, JLabel.CENTER);
            _local1.appendAll(ASwingHelper.verticalStrut(90), _local4);
            ASwingHelper.prepare(_local1);
            return (_local1);
        }

    }
}//package Display.peddlerUI.peddlerMarketUI 
